<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="./../layui/css/layui.css" media="all">
    <script src="./../layui/layui.js"></script>
    <script src="./../js/env.js"></script>
    <title>statistics</title>
    <style>
        #demo {
            width: 100%;
        }
    </style>
</head>

<body>
    <fieldset class="layui-elem-field layui-field-title">
        <legend>统计信息</legend>
    </fieldset>
    <table id="demo" lay-filter="test"></table>
</body>

</html>
<script>
    if (layui.sessionData('user').userInfo === undefined) {
        window.location.href = "../html/login.html"
    }
    layui.use('table', function () {
        var table = layui.table;
        //第一个实例
        table.render({
            elem: '#demo',
            headers: { sessionId: getToken() }
            , height: 312
            , url: abc() + '/admin/chargeStation/chargingStationsCount' //数据接口
            , page: true //开启分页
            , cols: [[ //表头
                { field: 'id', title: 'id', sort: true, fixed: 'left', align: 'center' }
                , { field: 'stationName', title: '充电站名字', align: 'center' }
                , { field: 'stationMonthOrder', title: '充电站月订单', align: 'center' }
                , { field: 'stationDayOrder', title: '充电站日订单', align: 'center' }

            ]]
            , request: {
                pageName: 'page' //页码的参数名称，默认：page
                , limitName: 'pageSize' //每页数据量的参数名，默认：limit
            }
            , done: function (res, curr, count) {
                if (res.code === 100) {
                    layer.msg("登录失效，请重新登录")
                    window.location.href = "../html/login.html"
                    return;
                }
            }
            , parseData: function (res) { //res 即为原始返回的数据
                if (res.code !== 0) {
                    return {
                        "code": res.code, //解析接口状态
                        "msg": res.msg //解析提示文本
                    };
                } else {
                    return {
                        "code": res.code, //解析接口状态
                        "msg": res.msg, //解析提示文本
                        "count": res.data.total, //解析数据长度
                        "data": res.data.list //解析数据列表
                    };
                }

            }
        });

    });
</script>